package eliauk.fun.springboot_start_sdk_demo.config;

import eliauk.fun.springboot_start_sdk_demo.ApiClient;
import eliauk.fun.springboot_start_sdk_demo.properties.ApiClientProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(ApiClientProperties.class)
public class ApiClientAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public ApiClient jingApiClient(ApiClientProperties properties) {
        return new ApiClient(properties.getAccessKey(), properties.getSecretKey());
    }
}
